package ru.paswd.compare.rest.controllers.v1;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;
import ru.paswd.compare.rest.Matrix;
import ru.paswd.compare.rest.api.MatrixApi;
import ru.paswd.compare.rest.api.MatrixRequest;

import java.util.List;

@Slf4j
@RestController
public class MatrixController implements MatrixApi {

    @Override
    public List<List<Double>> multiplication(MatrixRequest request) {
        Matrix matrix1 = new Matrix(request.getFirst());
        Matrix matrix2 = new Matrix(request.getSecond());

        return Matrix.multiply(matrix1, matrix2).getData();
    }
}
